//
//  MainTableViewCell.m
//  WZYInteriorDesign
//
//  Created by lanou on 15/12/17.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "MainTableViewCell.h"
#import "UIImageView+AFNetworking.h"
#import "MainLabelModel.h"
@implementation MainTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.pictureView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 5, kWidth - 20, 200)];
        [self setImageLayer:self.pictureView];
        [self.contentView addSubview:self.pictureView];
        
        self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 205, 320, 20)];
        [self setTitleLabel:self.nameLabel];
        [self.contentView addSubview:self.nameLabel];
        

        self.titleSubLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 230, 320, 20)];
        [self setTitleLabel2:self.titleSubLabel];
        [self.contentView addSubview:self.titleSubLabel];
        
    }
    return self;
}



//设置图片格式
- (void)setImageLayer:(UIImageView *)imageView{
    imageView.layer.masksToBounds = YES;
    imageView.layer.borderWidth = 2;
    imageView.layer.borderColor = [[UIColor whiteColor]CGColor];

}

//设置文字格式
- (void)setTitleLabel:(UILabel *)titleLabel1{
    titleLabel1.font = [UIFont boldSystemFontOfSize:16.0];
    titleLabel1.textColor = [UIColor orangeColor];
    titleLabel1.numberOfLines = 0;
}
- (void)setTitleLabel2:(UILabel *)titleLabel1{
    titleLabel1.font = [UIFont systemFontOfSize:12.0];
    titleLabel1.textColor = [UIColor grayColor];
    titleLabel1.numberOfLines = 0;
}

- (void)setMainModel:(MainLabelModel *)mainModel{
    
    if (_mainModel != mainModel) {
        _mainModel = mainModel;
        [_pictureView setImageWithURL:[NSURL URLWithString:mainModel.cover_pic]];
        _titleSubLabel.text = mainModel.title_sub;
        _nameLabel.text = mainModel.title;
    }
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
